home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Nave / goobers.swf / scripts / frame_92 / PlaceObject2_76_82 / CLIPACTIONRECORD onClipEvent(enterFrame).as next >
Encoding:
Text File  |  2007-03-28  |  2.3 KB  |  77 lines

  1. onClipEvent(enterFrame){
  2.    this._visible = active;
  3.    this.gotoAndStop(_parent.current_level);
  4.    if(active)
  5.    {
  6.       x = calculate_x(t);
  7.       y = calculate_y(t);
  8.       this._x = x;
  9.       this._y = y;
  10.       dx = calculate_x(t + inc) - x;
  11.       dy = calculate_y(t + inc) - y;
  12.       this._rotation = Math.atan2(dy,dx) * 180 / 3.141592653589793;
  13.       if(this.hitTest(_parent.player) && _parent.player.status != "hit")
  14.       {
  15.          _parent.score -= 25;
  16.          _parent.num_lives--;
  17.          t = 1;
  18.          if(_parent.num_lives == 0)
  19.          {
  20.             _parent.prompts.gotoAndPlay("game_over");
  21.             _parent.player.status = "game over";
  22.             _parent.player.previous_status = "game over";
  23.             _parent.player.status = "game over";
  24.             _parent.player.gotoAndPlay(2);
  25.          }
  26.          else
  27.          {
  28.             _parent.player.previous_status = _parent.player.status;
  29.             _parent.player.status = "hit";
  30.             _parent.player.gotoAndPlay(2);
  31.          }
  32.       }
  33.       t += inc;
  34.       if(1 < t || t < 0)
  35.       {
  36.          current_time++;
  37.          if(current_time >= num_times)
  38.          {
  39.             t = 0;
  40.             current_time = 0;
  41.             active = false;
  42.             var j = 0;
  43.             while(j < 5)
  44.             {
  45.                base_points[j].x = _parent.xctr - (base_points[j].x - _parent.xctr);
  46.                j++;
  47.             }
  48.             _parent.create_boss(_parent.current_level,_parent.xctr,_parent.yctr);
  49.             _parent.current_level = _parent.current_level + 1;
  50.             _parent.current_round = 1;
  51.             _parent.player.status = "boss";
  52.          }
  53.          else
  54.          {
  55.             t = Math.round(Math.random());
  56.             if(t == 0 && inc < 0)
  57.             {
  58.                inc *= -1;
  59.                inc += 0.0005;
  60.             }
  61.             else if(t == 1 && 0 < inc)
  62.             {
  63.                inc *= -1;
  64.                inc -= 0.0005;
  65.             }
  66.             var j = 0;
  67.             while(j < 5)
  68.             {
  69.                control_points[j].x = base_points[j].x + Math.random() * 150 - 75;
  70.                control_points[j].y = base_points[j].y + Math.random() * 150 - 75;
  71.                j++;
  72.             }
  73.          }
  74.       }
  75.    }
  76. }
  77.